namespace practiceCourse3 {
	function search(nums: number[], target: number): number {
		let left = 0;
		let right = nums.length;
		while (left < right) {
			let mid = left + Math.floor((right - left) / 2);
			if (target < nums[mid]) {
				right = mid;
			} else if (target > nums[mid]) {
				left = mid + 1;
			} else {
				return mid;
			}
		}
		return -1;
	}
}
